All Questions
60 questions
4votes
0answers
216views
GeekTrust: Traffic problem - functional programming
First attempt to write functional programming, been following OO paradigm all through my programming journey Please review the code and let me know if any comments and violations of functional ...
2votes
1answer
97views
Project Euler 1 using functional programming in JS
So I am once again beating a dead horse, by solving the first Project Euler problem: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these ...
6votes
4answers
3kviews
Find all letter Combinations of a Phone Number
The task is taken from LeetCode Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to letters (just ...
2votes
1answer
757views
Given time intervals determine if a person could attend all meetings
The task is taken from LeetCode Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] ...
1vote
1answer
291views
Merge k Sorted Lists
The task is taken from LeetCode Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: ...
8votes
1answer
2kviews
Merge Intervals in JavaScript
This is a task taken from Leetcode - Given a collection of intervals, merge all overlapping intervals. Example 1: ...
7votes
1answer
4kviews
Given a string containing just parentheses, determine if the input string is valid
The task is taken from leetcode Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: ...
2votes
1answer
2kviews
Find common characters (LeetCode)
The task is taken from leetcode Given an array A of strings made only from lowercase letters, return a list of all characters that show up in all strings within the list (including duplicates). ...
3votes
2answers
898views
Robot Return to Origin
The task is taken from leetcode There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it completes ...
1vote
2answers
118views
Flipping an Image
The task is taken from leetcode Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image. To flip an ...
1vote
1answer
530views
Sort Array By Parity
The task is taken from leetcode Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A. You may return any ...
0votes
1answer
52views
Items also occurs in a set
The task You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how ...
2votes
0answers
733views
Determine whether there exists a one-to-one character mapping from one string to another
The task Determine whether there exists a one-to-one character mapping from one string s1 to another s2. For example, given s1 = abc and s2 = bcd, return true since we can map a to b, b to c, and c ...
1vote
2answers
1kviews
Sum of two numbers in array
The task You are given two non-empty arrays representing two non-negative integers. The digits are stored in reverse order and each of their items contain a single digit. Add the two numbers and ...
1vote
1answer
1kviews
Find busiest period in building
The task You are given a list of data entries that represent entries and exits of groups of people into a building. An entry looks like this: {"timestamp": 1526579928, count: 3, "type": "...